<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li :class="{completed:!item.isDone}"  v-for="(item,id) in this.list " :key="id" >
      <div class="view" >
        <input class="toggle" type="checkbox" v-model="item.isDone" />
        <label> {{item.name}} </label>
        <button class="destroy" @click="del(item.id)" ></button>
      </div>
    </li>
  </ul>
  
</template>

<script>
export default {
    props:["list","isDone"],
    methods:{
   del(id){
   //1.触发父组件身上的删除事件
   this.$emit("sub",id)
   }
    }
   
}
</script>